'use strict'

angular.module('webAppApp')
  .directive 'ngConfirmClick', ->
    restrict: 'A'
    link: (scope, element, attrs) ->
      element.bind 'click', (e)->
        message = attrs.confirmation || "Are you sure?"
        if window.confirm message
          action = attrs.ngConfirmClick
          if action
            scope.$apply(scope.$eval(action))
